#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;

int main()
{
    IOS;
    ll n;
    while(cin>>n){
        if(n<3){
            cout<<n<<endl;
            continue;
        }
        ll ans=0;
        ans+=n;
        while(n>=3){
            ll k=n/3;
            ans+=k;
            n=n-k*3+k;
        }
        cout<<ans<<endl;
    }
    getchar();
    getchar();
    return 0;
}
